<template>
  <el-row>
    <el-col :span="24">
      <el-row style="margin-bottom: 20px; text-align: right">
        <el-button type="primary" @click="addProjectDialog = true">新增项目</el-button>
      </el-row>
      <el-table
        :data="tableData"
        border
        style="width: 100%">
        <el-table-column
          prop="date"
          align="center"
          label="项目名称">
        </el-table-column>
        <el-table-column
          prop="name"
          align="center"
          label="创建时间">
        </el-table-column>
        <el-table-column
          prop="字段3"
          align="center"
          label="管理账号">
        </el-table-column>
        <el-table-column label="操作" align="center">
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="primary"
              @click="handleEdit(scope.$index, scope.row)">查看</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-col>
    <addProjectDialog :addProjectDialog="addProjectDialog" @getDialogStatus="addDialogStatus"></addProjectDialog>
  </el-row>
</template>

<script>
  export default {
    name: "addProject",
    components: {
      addProjectDialog: resolve => {
        require(["../../components/project/addProject.vue"],resolve)
      }
    },
    data() {
      return {
        tableData: [{
          date: '2016-05-02',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1518 弄'
        }, {
          date: '2016-05-04',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1517 弄'
        }, {
          date: '2016-05-01',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1519 弄'
        }, {
          date: '2016-05-03',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1516 弄'
        }],
        addProjectDialog: false
      }
    },
    methods: {
      handleEdit(index, row) {
        console.log(index, row);
        this.addAdminDialog = true;
      },
      //模态框关闭事件
      addDialogStatus(flag) {
        this.addProjectDialog = false;
      }
    }
  }
</script>

<style scoped lang="scss">
</style>
